package cn.findviewbydream.evil.main.controller;

import cn.findviewbydream.evil.main.service.SettingKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/********************************************
 * 工程名：MealOrder
 * 包名：cn.findviewbydream.evil.main.controller
 * 时间：16-12-22
 * 作者：白雨濃 evil
 * 邮箱：evilbai@foxmail.com
 * 内容：设置界面->秘钥设置
 ********************************************/
@Controller
public class SettingKeyController
{
    private final SettingKeyService settingKeyService;

    @Autowired
    public SettingKeyController(SettingKeyService settingKeyService) {this.settingKeyService = settingKeyService;}

    @RequestMapping("/setting/key")
    public String index(Model model)
    {
        model.addAttribute("key", settingKeyService.getKey());
        return "setting/key";
    }

    @RequestMapping("/setting/key/post")
    @ResponseBody
    public boolean postKey(String key)
    {
        return settingKeyService.postKey(key);
    }

}
